from typing import Optional
from sqlmodel import Field, SQLModel
from models.common import get_current_time
from enum import Enum
from pydantic import BaseModel

class Base(SQLModel):
    id: Optional[int] = Field(default=None,primary_key=True)

class BaseAndTime(Base):
    createtime:  Optional[int] = Field(default=get_current_time(), nullable=False,title='创建时间')
    updatetime: Optional[int] = Field(default=get_current_time(), nullable=False,title='更新时间')

class BaseAndTimeAndWeight(BaseAndTime):
    weight: int = Field(default=0,title='权重')

class Token(BaseModel):
    access_token: str
    token_type: str

class StatusTypeEnum(int, Enum):
    ABNORMAL = 0
    NORMAL = 1
